package com.virus.mall.model;

import com.virus.mall.utils.PropertiesUtils;

import java.util.List;

/**
 * @Classname Goods
 * @Description 商品信息bean
 * @Date 2021/4/16 23:25
 * @Created by virus
 */
public class Goods {

    private String domain = PropertiesUtils.DOMAIN;

    private Integer id;

    private String img;

    private String name;

    private Double price;

    private Integer typeId;

    private Integer stockNum;

    private String description;

    private List<Spec> specs;

    private boolean hasDomain = true;

    public Goods() {
    }

    public Goods(Integer id, String img, String name, Double price, Integer typeId, Integer stockNum, String description) {
        this.id = id;
        this.img = img;
        this.name = name;
        this.price = price;
        this.typeId = typeId;
        this.stockNum = stockNum;
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getImg() {
        if (hasDomain) {
            return domain + "/" + img;
        }
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public Integer getStockNum() {
        return stockNum;
    }

    public void setStockNum(Integer stockNum) {
        this.stockNum = stockNum;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<Spec> getSpecs() {
        return specs;
    }

    public void setSpecs(List<Spec> specs) {
        this.specs = specs;
    }

    public void setHasDomain(boolean hasDomain) {
        this.hasDomain = hasDomain;
    }
}
